package com.leileimann.tour.controller.AdminPages;

import com.leileimann.tour.entity.SSpot;
import com.leileimann.tour.mapper.SSpotMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author leileiMann
 * @date 2022/4/9 23:50
 */
@Controller
@RequestMapping("/adsspot")
public class AdSSpotController {
    @Autowired
    private SSpotMapper sSpotMapper;

    /**景区分页显示*/
    @RequestMapping("/showSSpotByPageNum")
    @ResponseBody
    public List<SSpot> showSSpotByPageNum(int pageNum){
        List<SSpot> list = sSpotMapper.getAllSSpot(pageNum);
        return list;
    }

    /**通过景区名模糊查询景区*/
    @RequestMapping("/findSSpotByMH")
    @ResponseBody
    public List<SSpot> findSSpotByMH(String sspotname){
        List<SSpot> sspot = sSpotMapper.findSSpotByMH(sspotname);
        int num = sSpotMapper.findNumOfSSpot(sspotname,null);
        System.out.println("模糊查询结果的数量为:" +num);
        return sspot;
    }
}
